

<!DOCTYPE html>
<!--[if IE 8]><html class="no-js lt-ie9" lang="en" > <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en" > <!--<![endif]-->
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>dynamic_rest package &mdash; Dynamic REST 1.3.15 documentation</title>
  

  
  

  

  
  
    

  

  
  
    <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  

  

  
    <link rel="top" title="Dynamic REST 1.3.15 documentation" href="index.html"/>
        <link rel="prev" title="Dynamic REST Tutorial" href="tutorial.html"/> 

  
  <script src="_static/js/modernizr.min.js"></script>

</head>

<body class="wy-body-for-nav" role="document">

  <div class="wy-grid-for-nav">

    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search">
          

          
            <a href="index.html" class="icon icon-home"> Dynamic REST
          

          
          </a>

          
            
            
              <div class="version">
                1.3.15
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
                <p class="caption"><span class="caption-text">Contents</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Dynamic REST Tutorial</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="">dynamic_rest package</a><ul>
<li class="toctree-l2"><a class="reference internal" href="#submodules">Submodules</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.bases">dynamic_rest.bases module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.conf">dynamic_rest.conf module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.constants">dynamic_rest.constants module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.datastructures">dynamic_rest.datastructures module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.fields">dynamic_rest.fields module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.filters">dynamic_rest.filters module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.links">dynamic_rest.links module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.meta">dynamic_rest.meta module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.metadata">dynamic_rest.metadata module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.pagination">dynamic_rest.pagination module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.patches">dynamic_rest.patches module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.processors">dynamic_rest.processors module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.related">dynamic_rest.related module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.renderers">dynamic_rest.renderers module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.routers">dynamic_rest.routers module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.serializers">dynamic_rest.serializers module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.tagged">dynamic_rest.tagged module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest.viewsets">dynamic_rest.viewsets module</a></li>
<li class="toctree-l2"><a class="reference internal" href="#module-dynamic_rest">Module contents</a></li>
</ul>
</li>
</ul>

            
          
        </div>
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" role="navigation" aria-label="top navigation">
        <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
        <a href="index.html">Dynamic REST</a>
      </nav>


      
      <div class="wy-nav-content">
        <div class="rst-content">
          





<div role="navigation" aria-label="breadcrumbs navigation">
  <ul class="wy-breadcrumbs">
    <li><a href="index.html">Docs</a> &raquo;</li>
      
    <li>dynamic_rest package</li>
      <li class="wy-breadcrumbs-aside">
        
          
            <a href="_sources/dynamic_rest.txt" rel="nofollow"> View page source</a>
          
        
      </li>
  </ul>
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="dynamic-rest-package">
<h1>dynamic_rest package<a class="headerlink" href="#dynamic-rest-package" title="Permalink to this headline">¶</a></h1>
<div class="section" id="submodules">
<h2>Submodules<a class="headerlink" href="#submodules" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-dynamic_rest.bases">
<span id="dynamic-rest-bases-module"></span><h2>dynamic_rest.bases module<a class="headerlink" href="#module-dynamic_rest.bases" title="Permalink to this headline">¶</a></h2>
<p>This module contains base classes for DREST.</p>
<dl class="class">
<dt id="dynamic_rest.bases.DynamicSerializerBase">
<em class="property">class </em><code class="descclassname">dynamic_rest.bases.</code><code class="descname">DynamicSerializerBase</code><a class="reference internal" href="_modules/dynamic_rest/bases.html#DynamicSerializerBase"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.bases.DynamicSerializerBase" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Base class for all DREST serializers.</p>
</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.conf">
<span id="dynamic-rest-conf-module"></span><h2>dynamic_rest.conf module<a class="headerlink" href="#module-dynamic_rest.conf" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="dynamic_rest.conf.Settings">
<em class="property">class </em><code class="descclassname">dynamic_rest.conf.</code><code class="descname">Settings</code><span class="sig-paren">(</span><em>name</em>, <em>defaults</em>, <em>settings</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/conf.html#Settings"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.conf.Settings" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<dl class="method">
<dt id="dynamic_rest.conf.Settings.__getattr__">
<code class="descname">__getattr__</code><span class="sig-paren">(</span><em>attr</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.conf.Settings.__getattr__" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a setting.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.constants">
<span id="dynamic-rest-constants-module"></span><h2>dynamic_rest.constants module<a class="headerlink" href="#module-dynamic_rest.constants" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-dynamic_rest.datastructures">
<span id="dynamic-rest-datastructures-module"></span><h2>dynamic_rest.datastructures module<a class="headerlink" href="#module-dynamic_rest.datastructures" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom data-structures.</p>
<dl class="class">
<dt id="dynamic_rest.datastructures.TreeMap">
<em class="property">class </em><code class="descclassname">dynamic_rest.datastructures.</code><code class="descname">TreeMap</code><a class="reference internal" href="_modules/dynamic_rest/datastructures.html#TreeMap"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.datastructures.TreeMap" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">dict</span></code></p>
<p>Tree structure implemented with nested dictionaries.</p>
<dl class="method">
<dt id="dynamic_rest.datastructures.TreeMap.get_paths">
<code class="descname">get_paths</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/datastructures.html#TreeMap.get_paths"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.datastructures.TreeMap.get_paths" title="Permalink to this definition">¶</a></dt>
<dd><p>Get all paths from the root to the leaves.</p>
<p>For example, given a chain like <cite>{&#8216;a&#8217;:{&#8216;b&#8217;:{&#8216;c&#8217;:None}}}</cite>,
this method would return <cite>[[&#8216;a&#8217;, &#8216;b&#8217;, &#8216;c&#8217;]]</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A list of lists of paths.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.datastructures.TreeMap.insert">
<code class="descname">insert</code><span class="sig-paren">(</span><em>parts</em>, <em>leaf_value</em>, <em>update=False</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/datastructures.html#TreeMap.insert"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.datastructures.TreeMap.insert" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a list of nodes into the tree.</p>
<p>The list will be converted into a TreeMap (chain) and then
merged with the current TreeMap.</p>
<p>For example, this method would insert <cite>[&#8216;a&#8217;,&#8217;b&#8217;,&#8217;c&#8217;]</cite> as
<cite>{&#8216;a&#8217;:{&#8216;b&#8217;:{&#8216;c&#8217;:{}}}}</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>parts</strong> &#8211; List of nodes representing a chain.</li>
<li><strong>leaf_value</strong> &#8211; Value to insert into the leaf of the chain.</li>
<li><strong>update</strong> &#8211; Whether or not to update the leaf with the given value or
to replace the value.</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">self</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.fields">
<span id="dynamic-rest-fields-module"></span><h2>dynamic_rest.fields module<a class="headerlink" href="#module-dynamic_rest.fields" title="Permalink to this headline">¶</a></h2>
</div>
<div class="section" id="module-dynamic_rest.filters">
<span id="dynamic-rest-filters-module"></span><h2>dynamic_rest.filters module<a class="headerlink" href="#module-dynamic_rest.filters" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom filter backends.</p>
<dl class="class">
<dt id="dynamic_rest.filters.DynamicFilterBackend">
<em class="property">class </em><code class="descclassname">dynamic_rest.filters.</code><code class="descname">DynamicFilterBackend</code><a class="reference internal" href="_modules/dynamic_rest/filters.html#DynamicFilterBackend"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.DynamicFilterBackend" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">rest_framework.filters.BaseFilterBackend</span></code></p>
<p>A DRF filter backend that construct DREST querysets.</p>
<p>This backend is responsible for interpretting and applying
filters, includes, and excludes to the base queryset of a view.</p>
<dl class="attribute">
<dt id="dynamic_rest.filters.DynamicFilterBackend.VALID_FILTER_OPERATORS">
<code class="descname">VALID_FILTER_OPERATORS</code><a class="headerlink" href="#dynamic_rest.filters.DynamicFilterBackend.VALID_FILTER_OPERATORS" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of filter operators.</p>
</dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.filters.DynamicFilterBackend.FALSEY_STRINGS">
<code class="descname">FALSEY_STRINGS</code><a class="headerlink" href="#dynamic_rest.filters.DynamicFilterBackend.FALSEY_STRINGS" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of strings that are interpretted as
False by the isnull operator.</p>
</dd></dl>

<dl class="attribute">
<dt>
<code class="descname">FALSEY_STRINGS</code><em class="property"> = ('0', 'false', '')</em></dt>
<dd></dd></dl>

<dl class="attribute">
<dt>
<code class="descname">VALID_FILTER_OPERATORS</code><em class="property"> = ('in', 'any', 'all', 'icontains', 'contains', 'startswith', 'istartswith', 'endswith', 'iendswith', 'year', 'month', 'day', 'week_day', 'regex', 'range', 'gt', 'lt', 'gte', 'lte', 'isnull', 'eq', 'iexact', None)</em></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.filters.DynamicFilterBackend.filter_queryset">
<code class="descname">filter_queryset</code><span class="sig-paren">(</span><em>request</em>, <em>queryset</em>, <em>view</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/filters.html#DynamicFilterBackend.filter_queryset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.DynamicFilterBackend.filter_queryset" title="Permalink to this definition">¶</a></dt>
<dd><p>Filter the queryset.</p>
<p>This is the main entry-point to this class, and
is called by DRF&#8217;s list handler.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.filters.DynamicSortingFilter">
<em class="property">class </em><code class="descclassname">dynamic_rest.filters.</code><code class="descname">DynamicSortingFilter</code><a class="reference internal" href="_modules/dynamic_rest/filters.html#DynamicSortingFilter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.DynamicSortingFilter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">rest_framework.filters.OrderingFilter</span></code></p>
<p>Subclass of DRF&#8217;s OrderingFilter.</p>
<p>This class adds support for multi-field ordering and rewritten fields.</p>
<dl class="method">
<dt id="dynamic_rest.filters.DynamicSortingFilter.filter_queryset">
<code class="descname">filter_queryset</code><span class="sig-paren">(</span><em>request</em>, <em>queryset</em>, <em>view</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/filters.html#DynamicSortingFilter.filter_queryset"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.DynamicSortingFilter.filter_queryset" title="Permalink to this definition">¶</a></dt>
<dd><p>&#8220;Filter the queryset, applying the ordering.</p>
<p>The <cite>ordering_param</cite> can be overwritten here.
In DRF, the ordering_param is &#8216;ordering&#8217;, but we support changing it
to allow the viewset to control the parameter.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.filters.DynamicSortingFilter.get_ordering">
<code class="descname">get_ordering</code><span class="sig-paren">(</span><em>request</em>, <em>queryset</em>, <em>view</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/filters.html#DynamicSortingFilter.get_ordering"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.DynamicSortingFilter.get_ordering" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an ordering for a given request.</p>
<p>DRF expects a comma separated list, while DREST expects an array.
This method overwrites the DRF default so it can parse the array.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.filters.DynamicSortingFilter.get_valid_fields">
<code class="descname">get_valid_fields</code><span class="sig-paren">(</span><em>queryset</em>, <em>view</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/filters.html#DynamicSortingFilter.get_valid_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.DynamicSortingFilter.get_valid_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Return valid fields for ordering.</p>
<p>Overwrites DRF&#8217;s get_valid_fields method so that valid_fields returns
serializer fields, not model fields.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.filters.DynamicSortingFilter.remove_invalid_fields">
<code class="descname">remove_invalid_fields</code><span class="sig-paren">(</span><em>queryset</em>, <em>fields</em>, <em>view</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/filters.html#DynamicSortingFilter.remove_invalid_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.DynamicSortingFilter.remove_invalid_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Remove invalid fields from an ordering.</p>
<p>Overwrites the DRF default remove_invalid_fields method to return
both the valid orderings and any invalid orderings.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.filters.FilterNode">
<em class="property">class </em><code class="descclassname">dynamic_rest.filters.</code><code class="descname">FilterNode</code><span class="sig-paren">(</span><em>field</em>, <em>operator</em>, <em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/filters.html#FilterNode"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.FilterNode" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<dl class="method">
<dt id="dynamic_rest.filters.FilterNode.generate_query_key">
<code class="descname">generate_query_key</code><span class="sig-paren">(</span><em>serializer</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.filters.FilterNode.generate_query_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the key that can be passed to Django&#8217;s filter method.</p>
<p>To account for serialier field name rewrites, this method
translates serializer field names to model field names
by inspecting <cite>serializer</cite>.</p>
<p>For example, a query like <cite>filter{users.events}</cite> would be
returned as <cite>users__events</cite>.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>serializer</strong> &#8211; A DRF serializer</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A filter key.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.filters.FilterNode.key">
<code class="descname">key</code><a class="headerlink" href="#dynamic_rest.filters.FilterNode.key" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="dynamic_rest.filters.has_joins">
<code class="descclassname">dynamic_rest.filters.</code><code class="descname">has_joins</code><span class="sig-paren">(</span><em>queryset</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/filters.html#has_joins"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.filters.has_joins" title="Permalink to this definition">¶</a></dt>
<dd><p>Return True iff. a queryset includes joins.</p>
<p>If this is the case, it is possible for the queryset
to return duplicate results.</p>
</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.links">
<span id="dynamic-rest-links-module"></span><h2>dynamic_rest.links module<a class="headerlink" href="#module-dynamic_rest.links" title="Permalink to this headline">¶</a></h2>
<p>This module contains utilities to support API links.</p>
<dl class="function">
<dt id="dynamic_rest.links.merge_link_object">
<code class="descclassname">dynamic_rest.links.</code><code class="descname">merge_link_object</code><span class="sig-paren">(</span><em>serializer</em>, <em>data</em>, <em>instance</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/links.html#merge_link_object"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.links.merge_link_object" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a &#8216;links&#8217; attribute to the data that maps field names to URLs.</p>
<dl class="docutils">
<dt>NOTE: This is the format that Ember Data supports, but alternative</dt>
<dd>implementations are possible to support other formats.</dd>
</dl>
</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.meta">
<span id="dynamic-rest-meta-module"></span><h2>dynamic_rest.meta module<a class="headerlink" href="#module-dynamic_rest.meta" title="Permalink to this headline">¶</a></h2>
<p>Module containing Django meta helpers.</p>
<dl class="function">
<dt id="dynamic_rest.meta.get_model_field">
<code class="descclassname">dynamic_rest.meta.</code><code class="descname">get_model_field</code><span class="sig-paren">(</span><em>model</em>, <em>field_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/meta.html#get_model_field"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.meta.get_model_field" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a field given a model and field name.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>model</strong> &#8211; a Django model</li>
<li><strong>field_name</strong> &#8211; the name of a field</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">A Django field if <cite>field_name</cite> is a valid field for <cite>model</cite>,
None otherwise.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="dynamic_rest.meta.get_model_table">
<code class="descclassname">dynamic_rest.meta.</code><code class="descname">get_model_table</code><span class="sig-paren">(</span><em>model</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/meta.html#get_model_table"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.meta.get_model_table" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="function">
<dt id="dynamic_rest.meta.is_field_remote">
<code class="descclassname">dynamic_rest.meta.</code><code class="descname">is_field_remote</code><span class="sig-paren">(</span><em>model</em>, <em>field_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/meta.html#is_field_remote"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.meta.is_field_remote" title="Permalink to this definition">¶</a></dt>
<dd><p>Check whether a given model field is a remote field.</p>
<p>A remote field is the inverse of a one-to-many or a
many-to-many relationship.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>model</strong> &#8211; a Django model</li>
<li><strong>field_name</strong> &#8211; the name of a field</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if <cite>field_name</cite> is a remote field, False otherwise.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="function">
<dt id="dynamic_rest.meta.is_model_field">
<code class="descclassname">dynamic_rest.meta.</code><code class="descname">is_model_field</code><span class="sig-paren">(</span><em>model</em>, <em>field_name</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/meta.html#is_model_field"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.meta.is_model_field" title="Permalink to this definition">¶</a></dt>
<dd><p>Check whether a given field exists on a model.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
<li><strong>model</strong> &#8211; a Django model</li>
<li><strong>field_name</strong> &#8211; the name of a field</li>
</ul>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if <cite>field_name</cite> exists on <cite>model</cite>, False otherwise.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.metadata">
<span id="dynamic-rest-metadata-module"></span><h2>dynamic_rest.metadata module<a class="headerlink" href="#module-dynamic_rest.metadata" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom DRF metadata classes.</p>
<dl class="class">
<dt id="dynamic_rest.metadata.DynamicMetadata">
<em class="property">class </em><code class="descclassname">dynamic_rest.metadata.</code><code class="descname">DynamicMetadata</code><a class="reference internal" href="_modules/dynamic_rest/metadata.html#DynamicMetadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.metadata.DynamicMetadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">rest_framework.metadata.SimpleMetadata</span></code></p>
<p>A subclass of SimpleMetadata.</p>
<p>Adds <cite>properties</cite> and <cite>features</cite> to the metdata.</p>
<dl class="method">
<dt id="dynamic_rest.metadata.DynamicMetadata.determine_actions">
<code class="descname">determine_actions</code><span class="sig-paren">(</span><em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/metadata.html#DynamicMetadata.determine_actions"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.metadata.DynamicMetadata.determine_actions" title="Permalink to this definition">¶</a></dt>
<dd><p>Prevent displaying action-specific details.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.metadata.DynamicMetadata.determine_metadata">
<code class="descname">determine_metadata</code><span class="sig-paren">(</span><em>request</em>, <em>view</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/metadata.html#DynamicMetadata.determine_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.metadata.DynamicMetadata.determine_metadata" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds <cite>properties</cite> and <cite>features</cite> to the metadata response.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.metadata.DynamicMetadata.get_field_info">
<code class="descname">get_field_info</code><span class="sig-paren">(</span><em>field</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/metadata.html#DynamicMetadata.get_field_info"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.metadata.DynamicMetadata.get_field_info" title="Permalink to this definition">¶</a></dt>
<dd><p>Adds <cite>related_to</cite> and <cite>nullable</cite> to the metadata response.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.pagination">
<span id="dynamic-rest-pagination-module"></span><h2>dynamic_rest.pagination module<a class="headerlink" href="#module-dynamic_rest.pagination" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom pagination classes.</p>
<dl class="class">
<dt id="dynamic_rest.pagination.DynamicPageNumberPagination">
<em class="property">class </em><code class="descclassname">dynamic_rest.pagination.</code><code class="descname">DynamicPageNumberPagination</code><a class="reference internal" href="_modules/dynamic_rest/pagination.html#DynamicPageNumberPagination"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.pagination.DynamicPageNumberPagination" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">rest_framework.pagination.PageNumberPagination</span></code></p>
<p>A subclass of PageNumberPagination.</p>
<p>Adds support for pagination metadata and overrides for
pagination query parameters.</p>
<dl class="method">
<dt id="dynamic_rest.pagination.DynamicPageNumberPagination.get_page_metadata">
<code class="descname">get_page_metadata</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/pagination.html#DynamicPageNumberPagination.get_page_metadata"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.pagination.DynamicPageNumberPagination.get_page_metadata" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.pagination.DynamicPageNumberPagination.get_paginated_response">
<code class="descname">get_paginated_response</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/pagination.html#DynamicPageNumberPagination.get_paginated_response"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.pagination.DynamicPageNumberPagination.get_paginated_response" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.pagination.DynamicPageNumberPagination.max_page_size">
<code class="descname">max_page_size</code><em class="property"> = None</em><a class="headerlink" href="#dynamic_rest.pagination.DynamicPageNumberPagination.max_page_size" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.pagination.DynamicPageNumberPagination.page_query_param">
<code class="descname">page_query_param</code><em class="property"> = 'page'</em><a class="headerlink" href="#dynamic_rest.pagination.DynamicPageNumberPagination.page_query_param" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.pagination.DynamicPageNumberPagination.page_size">
<code class="descname">page_size</code><em class="property"> = 50</em><a class="headerlink" href="#dynamic_rest.pagination.DynamicPageNumberPagination.page_size" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.pagination.DynamicPageNumberPagination.page_size_query_param">
<code class="descname">page_size_query_param</code><em class="property"> = 'per_page'</em><a class="headerlink" href="#dynamic_rest.pagination.DynamicPageNumberPagination.page_size_query_param" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.patches">
<span id="dynamic-rest-patches-module"></span><h2>dynamic_rest.patches module<a class="headerlink" href="#module-dynamic_rest.patches" title="Permalink to this headline">¶</a></h2>
<p>This module contains patches for Django issues.</p>
<p>These patches are meant to be short-lived and are
extracted from Django code changes.</p>
<dl class="function">
<dt id="dynamic_rest.patches.patch_prefetch_one_level">
<code class="descclassname">dynamic_rest.patches.</code><code class="descname">patch_prefetch_one_level</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/patches.html#patch_prefetch_one_level"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.patches.patch_prefetch_one_level" title="Permalink to this definition">¶</a></dt>
<dd><p>This patch address Django bug <a class="reference external" href="https://code.djangoproject.com/ticket/24873">https://code.djangoproject.com/ticket/24873</a>,
which was merged into Django master
in commit 025c6553771a09b80563baedb5b8300a8b01312f
into django.db.models.query.</p>
<p>The code that follows is identical to the code in the above commit,
with all comments stripped out.</p>
</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.processors">
<span id="dynamic-rest-processors-module"></span><h2>dynamic_rest.processors module<a class="headerlink" href="#module-dynamic_rest.processors" title="Permalink to this headline">¶</a></h2>
<p>This module contains response processors.</p>
<dl class="class">
<dt id="dynamic_rest.processors.SideloadingProcessor">
<em class="property">class </em><code class="descclassname">dynamic_rest.processors.</code><code class="descname">SideloadingProcessor</code><span class="sig-paren">(</span><em>serializer</em>, <em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/processors.html#SideloadingProcessor"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.processors.SideloadingProcessor" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>A processor that sideloads serializer data.</p>
<p>Sideloaded records are returned under top-level
response keys and produces responses that are
typically smaller than their nested equivalent.</p>
<dl class="method">
<dt id="dynamic_rest.processors.SideloadingProcessor.is_dynamic">
<code class="descname">is_dynamic</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/processors.html#SideloadingProcessor.is_dynamic"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.processors.SideloadingProcessor.is_dynamic" title="Permalink to this definition">¶</a></dt>
<dd><p>Check whether the given data dictionary is a DREST structure.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>data</strong> &#8211; A dictionary representation of a DRF serializer.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.processors.SideloadingProcessor.prefix">
<code class="descname">prefix</code><em class="property"> = '+'</em><a class="headerlink" href="#dynamic_rest.processors.SideloadingProcessor.prefix" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.processors.SideloadingProcessor.process">
<code class="descname">process</code><span class="sig-paren">(</span><em>obj</em>, <em>parent=None</em>, <em>parent_key=None</em>, <em>depth=0</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/processors.html#SideloadingProcessor.process"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.processors.SideloadingProcessor.process" title="Permalink to this definition">¶</a></dt>
<dd><p>Recursively process the data for sideloading.</p>
<p>Converts the nested representation into a sideloaded representation.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.related">
<span id="dynamic-rest-related-module"></span><h2>dynamic_rest.related module<a class="headerlink" href="#module-dynamic_rest.related" title="Permalink to this headline">¶</a></h2>
<p>This module provides backwards compatibility for RelatedObject.</p>
</div>
<div class="section" id="module-dynamic_rest.renderers">
<span id="dynamic-rest-renderers-module"></span><h2>dynamic_rest.renderers module<a class="headerlink" href="#module-dynamic_rest.renderers" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom renderer classes.</p>
<dl class="class">
<dt id="dynamic_rest.renderers.DynamicBrowsableAPIRenderer">
<em class="property">class </em><code class="descclassname">dynamic_rest.renderers.</code><code class="descname">DynamicBrowsableAPIRenderer</code><a class="reference internal" href="_modules/dynamic_rest/renderers.html#DynamicBrowsableAPIRenderer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.renderers.DynamicBrowsableAPIRenderer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">rest_framework.renderers.BrowsableAPIRenderer</span></code></p>
<p>Renderer class that adds directory support to the Browsable API.</p>
<dl class="method">
<dt id="dynamic_rest.renderers.DynamicBrowsableAPIRenderer.get_context">
<code class="descname">get_context</code><span class="sig-paren">(</span><em>data</em>, <em>media_type</em>, <em>context</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/renderers.html#DynamicBrowsableAPIRenderer.get_context"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.renderers.DynamicBrowsableAPIRenderer.get_context" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.routers">
<span id="dynamic-rest-routers-module"></span><h2>dynamic_rest.routers module<a class="headerlink" href="#module-dynamic_rest.routers" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom router classes.</p>
<dl class="class">
<dt id="dynamic_rest.routers.DynamicRouter">
<em class="property">class </em><code class="descclassname">dynamic_rest.routers.</code><code class="descname">DynamicRouter</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/routers.html#DynamicRouter"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">rest_framework.routers.DefaultRouter</span></code></p>
<dl class="method">
<dt id="dynamic_rest.routers.DynamicRouter.get_api_root_view">
<code class="descname">get_api_root_view</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter.get_api_root_view" title="Permalink to this definition">¶</a></dt>
<dd><p>Return API root view, using the global directory.</p>
</dd></dl>

<dl class="staticmethod">
<dt id="dynamic_rest.routers.DynamicRouter.get_canonical_path">
<em class="property">static </em><code class="descname">get_canonical_path</code><span class="sig-paren">(</span><em>resource_key</em>, <em>pk=None</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter.get_canonical_path" title="Permalink to this definition">¶</a></dt>
<dd><p>Return canonical resource path.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>- Canonical resource key</strong> (<em>resource_key</em>) &#8211; i.e. Serializer.get_resource_key().</li>
<li><strong>-</strong> (<em>pk</em>) &#8211; </li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns: Absolute URL as string.</p>
</dd></dl>

<dl class="staticmethod">
<dt id="dynamic_rest.routers.DynamicRouter.get_canonical_serializer">
<em class="property">static </em><code class="descname">get_canonical_serializer</code><span class="sig-paren">(</span><em>resource_key</em>, <em>model=None</em>, <em>instance=None</em>, <em>resource_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter.get_canonical_serializer" title="Permalink to this definition">¶</a></dt>
<dd><p>Return canonical serializer for a given resource name.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>- Resource key, usually DB table for model-based</strong> (<em>resource_key</em>) &#8211; resources, otherwise the plural name.</li>
<li><strong>-</strong> (<em>instance</em>) &#8211; </li>
<li><strong>-</strong> &#8211; </li>
</ul>
</td>
</tr>
</tbody>
</table>
<p>Returns: serializer class</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.routers.DynamicRouter.get_relation_routes">
<code class="descname">get_relation_routes</code><span class="sig-paren">(</span><em>viewset</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter.get_relation_routes" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate routes to serve relational objects. This method will add
a sub-URL for each relational field.</p>
<p>e.g.
A viewset for the following serializer:</p>
<blockquote>
<div><dl class="docutils">
<dt>class UserSerializer(..):</dt>
<dd>events = DynamicRelationField(EventSerializer, many=True)
groups = DynamicRelationField(GroupSerializer, many=True)
location = DynamicRelationField(LocationSerializer)</dd>
</dl>
</div></blockquote>
<p>will have the following URLs added:</p>
<blockquote>
<div>/users/&lt;pk&gt;/events/
/users/&lt;pk&gt;/groups/
/users/&lt;pk&gt;/location/</div></blockquote>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.routers.DynamicRouter.get_routes">
<code class="descname">get_routes</code><span class="sig-paren">(</span><em>viewset</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter.get_routes" title="Permalink to this definition">¶</a></dt>
<dd><p>DREST routes injection, overrides DRF&#8217;s get_routes() method, which
gets called for each registered viewset.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.routers.DynamicRouter.register">
<code class="descname">register</code><span class="sig-paren">(</span><em>prefix</em>, <em>viewset</em>, <em>base_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter.register" title="Permalink to this definition">¶</a></dt>
<dd><p>Add any registered route into a global API directory.</p>
<p>If the prefix includes a path separator,
store the URL in the directory under the first path segment.
Otherwise, store it as-is.</p>
<p>For example, if there are two registered prefixes,
&#8216;v1/users&#8217; and &#8216;groups&#8217;, <cite>directory</cite> will look liks:</p>
<dl class="docutils">
<dt>{</dt>
<dd><dl class="first docutils">
<dt>&#8216;v1&#8217;: {</dt>
<dd><dl class="first docutils">
<dt>&#8216;users&#8217;: {</dt>
<dd>&#8216;_url&#8217;: &#8216;users-list&#8217;
&#8216;_viewset&#8217;: &lt;class &#8216;UserViewSet&#8217;&gt;</dd>
</dl>
<p class="last">},</p>
</dd>
</dl>
<p>}
&#8216;groups&#8217;: {</p>
<blockquote>
<div>&#8216;_url&#8217;: &#8216;groups-list&#8217;
&#8216;_viewset&#8217;: &lt;class &#8216;GroupViewSet&#8217;&gt;</div></blockquote>
<p class="last">}</p>
</dd>
</dl>
<p>}</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.routers.DynamicRouter.register_resource">
<code class="descname">register_resource</code><span class="sig-paren">(</span><em>viewset</em>, <em>namespace=None</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.routers.DynamicRouter.register_resource" title="Permalink to this definition">¶</a></dt>
<dd><p>Register a viewset that should be considered the canonical
endpoint for a particular resource. In addition to generating
and registering the route, it adds the route in a reverse map
to allow DREST to build the canonical URL for a given resource.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
<li><strong>- viewset class, should have serializer_class attr.</strong> (<em>viewset</em>) &#8211; </li>
<li><strong>-</strong> (<em>namespace</em>) &#8211; </li>
</ul>
</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="function">
<dt id="dynamic_rest.routers.get_directory">
<code class="descclassname">dynamic_rest.routers.</code><code class="descname">get_directory</code><span class="sig-paren">(</span><em>request</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/routers.html#get_directory"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.routers.get_directory" title="Permalink to this definition">¶</a></dt>
<dd><p>Get API directory as a nested list of lists.</p>
</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.serializers">
<span id="dynamic-rest-serializers-module"></span><h2>dynamic_rest.serializers module<a class="headerlink" href="#module-dynamic_rest.serializers" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom serializer classes.</p>
<dl class="class">
<dt id="dynamic_rest.serializers.DynamicEphemeralSerializer">
<em class="property">class </em><code class="descclassname">dynamic_rest.serializers.</code><code class="descname">DynamicEphemeralSerializer</code><span class="sig-paren">(</span><em>instance=None</em>, <em>data=&lt;class rest_framework.fields.empty&gt;</em>, <em>only_fields=None</em>, <em>include_fields=None</em>, <em>exclude_fields=None</em>, <em>request_fields=None</em>, <em>sideload=False</em>, <em>dynamic=True</em>, <em>embed=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicEphemeralSerializer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicEphemeralSerializer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#dynamic_rest.serializers.WithDynamicSerializerMixin" title="dynamic_rest.serializers.WithDynamicSerializerMixin"><code class="xref py py-class docutils literal"><span class="pre">dynamic_rest.serializers.WithDynamicSerializerMixin</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">rest_framework.serializers.Serializer</span></code></p>
<p>DREST-compatible baseclass for non-model serializers.</p>
<dl class="method">
<dt id="dynamic_rest.serializers.DynamicEphemeralSerializer.to_representation">
<code class="descname">to_representation</code><span class="sig-paren">(</span><em>instance</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.serializers.DynamicEphemeralSerializer.to_representation" title="Permalink to this definition">¶</a></dt>
<dd><p>Provides post processing. Sub-classes should implement their own
to_representation method, but pass the resulting dict through
this function to get tagging and field selection.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>instance</strong> &#8211; Serialized dict, or object. If object,
it will be serialized by the super class&#8217;s
to_representation() method.</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.serializers.DynamicListSerializer">
<em class="property">class </em><code class="descclassname">dynamic_rest.serializers.</code><code class="descname">DynamicListSerializer</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicListSerializer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#dynamic_rest.serializers.WithResourceKeyMixin" title="dynamic_rest.serializers.WithResourceKeyMixin"><code class="xref py py-class docutils literal"><span class="pre">dynamic_rest.serializers.WithResourceKeyMixin</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">rest_framework.serializers.ListSerializer</span></code></p>
<p>Custom ListSerializer class.</p>
<p>This implementation delegates DREST-specific methods to
the child serializer and performs post-processing before
returning the data.</p>
<dl class="attribute">
<dt id="dynamic_rest.serializers.DynamicListSerializer.data">
<code class="descname">data</code><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.data" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the data, after performing post-processing if necessary.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.DynamicListSerializer.get_model">
<code class="descname">get_model</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicListSerializer.get_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.get_model" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the child&#8217;s model.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.DynamicListSerializer.get_name">
<code class="descname">get_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicListSerializer.get_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.get_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the child&#8217;s name.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.DynamicListSerializer.get_plural_name">
<code class="descname">get_plural_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicListSerializer.get_plural_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.get_plural_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the child&#8217;s plural name.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.DynamicListSerializer.id_only">
<code class="descname">id_only</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicListSerializer.id_only"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.id_only" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the child&#8217;s rendering mode.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.DynamicListSerializer.to_representation">
<code class="descname">to_representation</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicListSerializer.to_representation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.to_representation" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.DynamicListSerializer.update">
<code class="descname">update</code><span class="sig-paren">(</span><em>queryset</em>, <em>validated_data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicListSerializer.update"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.update" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.serializers.DynamicListSerializer.update_lookup_field">
<code class="descname">update_lookup_field</code><em class="property"> = 'id'</em><a class="headerlink" href="#dynamic_rest.serializers.DynamicListSerializer.update_lookup_field" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.serializers.DynamicModelSerializer">
<em class="property">class </em><code class="descclassname">dynamic_rest.serializers.</code><code class="descname">DynamicModelSerializer</code><span class="sig-paren">(</span><em>instance=None</em>, <em>data=&lt;class rest_framework.fields.empty&gt;</em>, <em>only_fields=None</em>, <em>include_fields=None</em>, <em>exclude_fields=None</em>, <em>request_fields=None</em>, <em>sideload=False</em>, <em>dynamic=True</em>, <em>embed=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#DynamicModelSerializer"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.DynamicModelSerializer" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#dynamic_rest.serializers.WithDynamicModelSerializerMixin" title="dynamic_rest.serializers.WithDynamicModelSerializerMixin"><code class="xref py py-class docutils literal"><span class="pre">dynamic_rest.serializers.WithDynamicModelSerializerMixin</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">rest_framework.serializers.ModelSerializer</span></code></p>
<p>DREST-compatible model-based serializer.</p>
</dd></dl>

<dl class="class">
<dt id="dynamic_rest.serializers.EphemeralObject">
<em class="property">class </em><code class="descclassname">dynamic_rest.serializers.</code><code class="descname">EphemeralObject</code><span class="sig-paren">(</span><em>values_dict</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#EphemeralObject"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.EphemeralObject" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Object that initializes attributes from a dict.</p>
</dd></dl>

<dl class="class">
<dt id="dynamic_rest.serializers.WithDynamicModelSerializerMixin">
<em class="property">class </em><code class="descclassname">dynamic_rest.serializers.</code><code class="descname">WithDynamicModelSerializerMixin</code><span class="sig-paren">(</span><em>instance=None</em>, <em>data=&lt;class rest_framework.fields.empty&gt;</em>, <em>only_fields=None</em>, <em>include_fields=None</em>, <em>exclude_fields=None</em>, <em>request_fields=None</em>, <em>sideload=False</em>, <em>dynamic=True</em>, <em>embed=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicModelSerializerMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicModelSerializerMixin" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#dynamic_rest.serializers.WithDynamicSerializerMixin" title="dynamic_rest.serializers.WithDynamicSerializerMixin"><code class="xref py py-class docutils literal"><span class="pre">dynamic_rest.serializers.WithDynamicSerializerMixin</span></code></a></p>
<p>Adds DREST serializer methods specific to model-based serializers.</p>
<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicModelSerializerMixin.get_id_fields">
<code class="descname">get_id_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicModelSerializerMixin.get_id_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Called to return a list of fields consisting of, at minimum,
the PK field name. The output of this method is used to
construct a Prefetch object with a .only() queryset
when this field is not being sideloaded but we need to
return a list of IDs.</p>
</dd></dl>

<dl class="classmethod">
<dt id="dynamic_rest.serializers.WithDynamicModelSerializerMixin.get_model">
<em class="property">classmethod </em><code class="descname">get_model</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicModelSerializerMixin.get_model" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin">
<em class="property">class </em><code class="descclassname">dynamic_rest.serializers.</code><code class="descname">WithDynamicSerializerMixin</code><span class="sig-paren">(</span><em>instance=None</em>, <em>data=&lt;class rest_framework.fields.empty&gt;</em>, <em>only_fields=None</em>, <em>include_fields=None</em>, <em>exclude_fields=None</em>, <em>request_fields=None</em>, <em>sideload=False</em>, <em>dynamic=True</em>, <em>embed=False</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#dynamic_rest.serializers.WithResourceKeyMixin" title="dynamic_rest.serializers.WithResourceKeyMixin"><code class="xref py py-class docutils literal"><span class="pre">dynamic_rest.serializers.WithResourceKeyMixin</span></code></a>, <a class="reference internal" href="#dynamic_rest.bases.DynamicSerializerBase" title="dynamic_rest.bases.DynamicSerializerBase"><code class="xref py py-class docutils literal"><span class="pre">dynamic_rest.bases.DynamicSerializerBase</span></code></a></p>
<p>Base class for DREST serializers.</p>
<p>This class provides support for dynamic field inclusions/exclusions.</p>
<dl class="attribute">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.data">
<code class="descname">data</code><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.data" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.get_all_fields">
<code class="descname">get_all_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.get_all_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.get_all_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the entire serializer field set.</p>
<p>Does not respect dynamic field inclusions/exclusions.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.get_fields">
<code class="descname">get_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.get_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.get_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the serializer&#8217;s field set.</p>
<p>If <cite>dynamic</cite> is True, respects field inclusions/exlcusions.
Otherwise, reverts back to standard DRF behavior.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.get_link_fields">
<code class="descname">get_link_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.get_link_fields"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.get_link_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Construct dict of name:field for linkable fields.</p>
</dd></dl>

<dl class="classmethod">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.get_model">
<em class="property">classmethod </em><code class="descname">get_model</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.get_model"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.get_model" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the model, if the serializer has one.</p>
<p>Model serializers should implement this method.</p>
</dd></dl>

<dl class="classmethod">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.get_name">
<em class="property">classmethod </em><code class="descname">get_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.get_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.get_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the serializer name.</p>
<p>The name can be defined on the Meta class or will be generated
automatically from the model name.</p>
</dd></dl>

<dl class="classmethod">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.get_plural_name">
<em class="property">classmethod </em><code class="descname">get_plural_name</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.get_plural_name"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.get_plural_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the serializer&#8217;s plural name.</p>
<p>The plural name may be defined on the Meta class.
If the plural name is not defined,
the pluralized form of the name will be returned.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.id_only">
<code class="descname">id_only</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.id_only"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.id_only" title="Permalink to this definition">¶</a></dt>
<dd><p>Check whether the serializer should return an ID instead of an object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">True if and only if <cite>request_fields</cite> is True.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.save">
<code class="descname">save</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.save"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.save" title="Permalink to this definition">¶</a></dt>
<dd><p>Serializer save that address prefetch issues.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.to_internal_value">
<code class="descname">to_internal_value</code><span class="sig-paren">(</span><em>data</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.to_internal_value"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.to_internal_value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.serializers.WithDynamicSerializerMixin.to_representation">
<code class="descname">to_representation</code><span class="sig-paren">(</span><em>instance</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithDynamicSerializerMixin.to_representation"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithDynamicSerializerMixin.to_representation" title="Permalink to this definition">¶</a></dt>
<dd><p>Modified to_representation method.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>instance</strong> &#8211; A model instance or data object.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Instance ID if the serializer is meant to represent its ID.
Otherwise, a tagged data dict representation.</td>
</tr>
</tbody>
</table>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.serializers.WithResourceKeyMixin">
<em class="property">class </em><code class="descclassname">dynamic_rest.serializers.</code><code class="descname">WithResourceKeyMixin</code><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithResourceKeyMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithResourceKeyMixin" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<dl class="method">
<dt id="dynamic_rest.serializers.WithResourceKeyMixin.get_resource_key">
<code class="descname">get_resource_key</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/serializers.html#WithResourceKeyMixin.get_resource_key"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.serializers.WithResourceKeyMixin.get_resource_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Return canonical resource key, usually the DB table name.</p>
</dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.tagged">
<span id="dynamic-rest-tagged-module"></span><h2>dynamic_rest.tagged module<a class="headerlink" href="#module-dynamic_rest.tagged" title="Permalink to this headline">¶</a></h2>
<p>This module contains tagging utilities for DREST data structures.</p>
<dl class="class">
<dt id="dynamic_rest.tagged.TaggedDict">
<em class="property">class </em><code class="descclassname">dynamic_rest.tagged.</code><code class="descname">TaggedDict</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/tagged.html#TaggedDict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.tagged.TaggedDict" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>Return object from <cite>to_representation</cite> for the <cite>Serializer</cite> class.
Includes a reference to the <cite>instance</cite> and the <cite>serializer</cite> represented.</p>
<dl class="method">
<dt id="dynamic_rest.tagged.TaggedDict.copy">
<code class="descname">copy</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.tagged.TaggedDict.copy" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

</dd></dl>

<dl class="function">
<dt id="dynamic_rest.tagged.tag_dict">
<code class="descclassname">dynamic_rest.tagged.</code><code class="descname">tag_dict</code><span class="sig-paren">(</span><em>obj</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/tagged.html#tag_dict"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.tagged.tag_dict" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a TaggedDict instance. Will either be a TaggedOrderedDict
or TaggedPlainDict depending on the type of <cite>obj</cite>.</p>
</dd></dl>

</div>
<div class="section" id="module-dynamic_rest.viewsets">
<span id="dynamic-rest-viewsets-module"></span><h2>dynamic_rest.viewsets module<a class="headerlink" href="#module-dynamic_rest.viewsets" title="Permalink to this headline">¶</a></h2>
<p>This module contains custom viewset classes.</p>
<dl class="class">
<dt id="dynamic_rest.viewsets.DynamicModelViewSet">
<em class="property">class </em><code class="descclassname">dynamic_rest.viewsets.</code><code class="descname">DynamicModelViewSet</code><span class="sig-paren">(</span><em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/viewsets.html#DynamicModelViewSet"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.viewsets.DynamicModelViewSet" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <a class="reference internal" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin" title="dynamic_rest.viewsets.WithDynamicViewSetMixin"><code class="xref py py-class docutils literal"><span class="pre">dynamic_rest.viewsets.WithDynamicViewSetMixin</span></code></a>, <code class="xref py py-class docutils literal"><span class="pre">rest_framework.viewsets.ModelViewSet</span></code></p>
<dl class="attribute">
<dt id="dynamic_rest.viewsets.DynamicModelViewSet.ENABLE_BULK_PARTIAL_CREATION">
<code class="descname">ENABLE_BULK_PARTIAL_CREATION</code><em class="property"> = False</em><a class="headerlink" href="#dynamic_rest.viewsets.DynamicModelViewSet.ENABLE_BULK_PARTIAL_CREATION" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.DynamicModelViewSet.ENABLE_BULK_UPDATE">
<code class="descname">ENABLE_BULK_UPDATE</code><em class="property"> = True</em><a class="headerlink" href="#dynamic_rest.viewsets.DynamicModelViewSet.ENABLE_BULK_UPDATE" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.DynamicModelViewSet.create">
<code class="descname">create</code><span class="sig-paren">(</span><em>request</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.DynamicModelViewSet.create" title="Permalink to this definition">¶</a></dt>
<dd><p>Either create a single or many model instances in bulk
using the Serializer&#8217;s many=True ability from Django REST &gt;= 2.2.5.</p>
<p>The data can be represented by the serializer name (single or plural
forms), dict or list.</p>
<p>Examples:</p>
<p>POST /dogs/
{</p>
<blockquote>
<div>&#8220;name&#8221;: &#8220;Fido&#8221;,
&#8220;age&#8221;: 2</div></blockquote>
<p>}</p>
<p>POST /dogs/
{</p>
<blockquote>
<div><dl class="docutils">
<dt>&#8220;dog&#8221;: {</dt>
<dd>&#8220;name&#8221;: &#8220;Lucky&#8221;,
&#8220;age&#8221;: 3</dd>
</dl>
<p>}</p>
</div></blockquote>
<p>}</p>
<p>POST /dogs/
{</p>
<blockquote>
<div><dl class="docutils">
<dt>&#8220;dogs&#8221;: [</dt>
<dd>{&#8220;name&#8221;: &#8220;Fido&#8221;, &#8220;age&#8221;: 2},
{&#8220;name&#8221;: &#8220;Lucky&#8221;, &#8220;age&#8221;: 3}</dd>
</dl>
<p>]</p>
</div></blockquote>
<p>}</p>
<p>POST /dogs/
[</p>
<blockquote>
<div>{&#8220;name&#8221;: &#8220;Fido&#8221;, &#8220;age&#8221;: 2},
{&#8220;name&#8221;: &#8220;Lucky&#8221;, &#8220;age&#8221;: 3}</div></blockquote>
<p>]</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.DynamicModelViewSet.update">
<code class="descname">update</code><span class="sig-paren">(</span><em>request</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.DynamicModelViewSet.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Either update  a single or many model instances. Use list to
indicate bulk update.</p>
<p>Examples:</p>
<p>PATCH /dogs/1/
{</p>
<blockquote>
<div>&#8216;fur&#8217;: &#8216;white&#8217;</div></blockquote>
<p>}</p>
<p>PATCH /dogs/
{</p>
<blockquote>
<div><dl class="docutils">
<dt>&#8216;dogs&#8217;: [</dt>
<dd>{&#8216;id&#8217;: 1, &#8216;fur&#8217;: &#8216;white&#8217;},
{&#8216;id&#8217;: 2, &#8216;fur&#8217;: &#8216;black&#8217;},
{&#8216;id&#8217;: 3, &#8216;fur&#8217;: &#8216;yellow&#8217;}</dd>
</dl>
<p>]</p>
</div></blockquote>
<p>}</p>
<p>PATCH /dogs/?filter{fur.contains}=brown
[</p>
<blockquote>
<div>{&#8216;id&#8217;: 3, &#8216;fur&#8217;: &#8216;gold&#8217;}</div></blockquote>
<p>]</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.viewsets.QueryParams">
<em class="property">class </em><code class="descclassname">dynamic_rest.viewsets.</code><code class="descname">QueryParams</code><span class="sig-paren">(</span><em>query_params</em>, <em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/viewsets.html#QueryParams"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.viewsets.QueryParams" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">django.http.request.QueryDict</span></code></p>
<p>Extension of Django&#8217;s QueryDict. Instantiated from a DRF Request
object, and returns a mutable QueryDict subclass. Also adds methods that
might be useful for our usecase.</p>
<dl class="method">
<dt id="dynamic_rest.viewsets.QueryParams.add">
<code class="descname">add</code><span class="sig-paren">(</span><em>key</em>, <em>value</em><span class="sig-paren">)</span><a class="reference internal" href="_modules/dynamic_rest/viewsets.html#QueryParams.add"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.viewsets.QueryParams.add" title="Permalink to this definition">¶</a></dt>
<dd><p>Method to accept a list of values and append to flat list.
QueryDict.appendlist(), if given a list, will append the list,
which creates nested lists. In most cases, we want to be able
to pass in a list (for convenience) but have it appended into
a flattened list.
TODO: Possibly throw an error if add() is used on a non-list param.</p>
</dd></dl>

</dd></dl>

<dl class="class">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin">
<em class="property">class </em><code class="descclassname">dynamic_rest.viewsets.</code><code class="descname">WithDynamicViewSetMixin</code><a class="reference internal" href="_modules/dynamic_rest/viewsets.html#WithDynamicViewSetMixin"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <code class="xref py py-class docutils literal"><span class="pre">object</span></code></p>
<p>A viewset that can support dynamic API features.</p>
<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.features">
<code class="descname">features</code><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.features" title="Permalink to this definition">¶</a></dt>
<dd><p>A list of features supported by the viewset.</p>
</dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.sideload">
<code class="descname">sideload</code><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.sideload" title="Permalink to this definition">¶</a></dt>
<dd><p>Whether or not to enable sideloading in the DynamicRenderer.</p>
</dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.meta">
<code class="descname">meta</code><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.meta" title="Permalink to this definition">¶</a></dt>
<dd><p>Extra data that is added to the response by the DynamicRenderer.</p>
</dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.EXCLUDE">
<code class="descname">EXCLUDE</code><em class="property"> = 'exclude[]'</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.EXCLUDE" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.FILTER">
<code class="descname">FILTER</code><em class="property"> = 'filter{}'</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.FILTER" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.INCLUDE">
<code class="descname">INCLUDE</code><em class="property"> = 'include[]'</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.INCLUDE" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.PAGE">
<code class="descname">PAGE</code><em class="property"> = 'page'</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.PAGE" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.PER_PAGE">
<code class="descname">PER_PAGE</code><em class="property"> = 'per_page'</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.PER_PAGE" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.SORT">
<code class="descname">SORT</code><em class="property"> = 'sort[]'</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.SORT" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt>
<code class="descname">features</code><em class="property"> = ('include[]', 'exclude[]', 'filter{}', 'page', 'per_page', 'sort[]')</em></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.filter_backends">
<code class="descname">filter_backends</code><em class="property"> = (&lt;class 'dynamic_rest.filters.DynamicFilterBackend'&gt;, &lt;class 'dynamic_rest.filters.DynamicSortingFilter'&gt;)</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.filter_backends" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.get_queryset">
<code class="descname">get_queryset</code><span class="sig-paren">(</span><em>queryset=None</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.get_queryset" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a queryset for this request.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>queryset</strong> &#8211; Optional root-level queryset.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.get_renderers">
<code class="descname">get_renderers</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.get_renderers" title="Permalink to this definition">¶</a></dt>
<dd><p>Optionally block Browsable API rendering.</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.get_request_feature">
<code class="descname">get_request_feature</code><span class="sig-paren">(</span><em>name</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.get_request_feature" title="Permalink to this definition">¶</a></dt>
<dd><p>Parses the request for a particular feature.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>name</strong> &#8211; A feature name.</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">A feature parsed from the URL if the feature is supported, or None.</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.get_request_fields">
<code class="descname">get_request_fields</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.get_request_fields" title="Permalink to this definition">¶</a></dt>
<dd><p>Parses the <cite>include[]</cite> and <cite>exclude[]</cite> features.</p>
<p>Extracts the dynamic field features from the request parameters
into a field map that can be passed to a serializer.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Returns:</th><td class="field-body">A nested dict mapping serializer keys to
True (include) or False (exclude).</td>
</tr>
</tbody>
</table>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.get_serializer">
<code class="descname">get_serializer</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.get_serializer" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.initialize_request">
<code class="descname">initialize_request</code><span class="sig-paren">(</span><em>request</em>, <em>*args</em>, <em>**kargs</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.initialize_request" title="Permalink to this definition">¶</a></dt>
<dd><p>Override DRF initialize_request() method to swap request.GET
(which is aliased by request.query_params) with a mutable instance
of QueryParams, and to convert request MergeDict to a subclass of dict
for consistency (MergeDict is not a subclass of dict)</p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.is_update">
<code class="descname">is_update</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.is_update" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.list_related">
<code class="descname">list_related</code><span class="sig-paren">(</span><em>request</em>, <em>pk=None</em>, <em>field_name=None</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.list_related" title="Permalink to this definition">¶</a></dt>
<dd><p>Fetch related object(s), as if sideloaded (used to support
link objects).</p>
<p>This method gets mapped to <cite>/&lt;resource&gt;/&lt;pk&gt;/&lt;field_name&gt;/</cite> by
DynamicRouter for all DynamicRelationField fields. Generally,
this method probably shouldn&#8217;t be overridden.</p>
<p>An alternative implementation would be to generate reverse queries.
For an exploration of that approach, see:</p>
<blockquote>
<div><a class="reference external" href="https://gist.github.com/ryochiji/54687d675978c7d96503">https://gist.github.com/ryochiji/54687d675978c7d96503</a></div></blockquote>
</dd></dl>

<dl class="attribute">
<dt>
<code class="descname">meta</code><em class="property"> = None</em></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.metadata_class">
<code class="descname">metadata_class</code><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.metadata_class" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal"><span class="pre">DynamicMetadata</span></code></p>
</dd></dl>

<dl class="method">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.paginate_queryset">
<code class="descname">paginate_queryset</code><span class="sig-paren">(</span><em>*args</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.paginate_queryset" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.pagination_class">
<code class="descname">pagination_class</code><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.pagination_class" title="Permalink to this definition">¶</a></dt>
<dd><p>alias of <code class="xref py py-class docutils literal"><span class="pre">DynamicPageNumberPagination</span></code></p>
</dd></dl>

<dl class="attribute">
<dt id="dynamic_rest.viewsets.WithDynamicViewSetMixin.renderer_classes">
<code class="descname">renderer_classes</code><em class="property"> = (&lt;class 'rest_framework.renderers.JSONRenderer'&gt;, &lt;class 'dynamic_rest.renderers.DynamicBrowsableAPIRenderer'&gt;)</em><a class="headerlink" href="#dynamic_rest.viewsets.WithDynamicViewSetMixin.renderer_classes" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>

<dl class="attribute">
<dt>
<code class="descname">sideload</code><em class="property"> = True</em></dt>
<dd></dd></dl>

</dd></dl>

</div>
<div class="section" id="module-dynamic_rest">
<span id="module-contents"></span><h2>Module contents<a class="headerlink" href="#module-dynamic_rest" title="Permalink to this headline">¶</a></h2>
<p>Dynamic REST (or DREST) is an extension of Django REST Framework.</p>
<p>DREST offers the following features on top of the standard DRF kit:</p>
<ul class="simple">
<li>Linked/embedded/sideloaded relationships</li>
<li>Field inclusions/exlusions</li>
<li>Field-based filtering/sorting</li>
<li>Directory panel for the browsable API</li>
<li>Optimizations</li>
</ul>
</div>
</div>


           </div>
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
      
        <a href="tutorial.html" class="btn btn-neutral" title="Dynamic REST Tutorial" accesskey="p"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        &copy; Copyright 2016, ant@altschool.com, ryo@altschool.com.

    </p>
  </div>
  Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/snide/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  


  

    <script type="text/javascript">
        var DOCUMENTATION_OPTIONS = {
            URL_ROOT:'./',
            VERSION:'1.3.15',
            COLLAPSE_INDEX:false,
            FILE_SUFFIX:'.html',
            HAS_SOURCE:  true
        };
    </script>
      <script type="text/javascript" src="_static/jquery.js"></script>
      <script type="text/javascript" src="_static/underscore.js"></script>
      <script type="text/javascript" src="_static/doctools.js"></script>

  

  
  
    <script type="text/javascript" src="_static/js/theme.js"></script>
  

  
  
  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.StickyNav.enable();
      });
  </script>
   

</body>
</html>
